import request from '@/utils/request'

// 查询会员列表
export function listUserV2(query) {
  return request({
    url: '/customer/v1/customer/page_v3',
    method: 'post',
    data: query
  })
}

// 查询会员列表
export function listUserV5(query) {
  return request({
    url: '/customer/v1/customer/page_v5',
    method: 'post',
    data: query
  })
}

// 查询会员列表(ip稽查不限制群组)
export function listUserV4(query) {
  return request({
    url: '/customer/v1/customer/page_v4',
    method: 'post',
    data: query
  })
}

// 查询会员详细
export function getUser(customerId) {
  return request({
    url: '/customer/v1/customer/' + customerId,
    method: 'get'
  })
}

// 新增会员
export function addUser(data) {
  return request({
    url: '/customer/v1/customer?google_code=' + data.google_code,
    method: 'post',
    data: data
  })
}

// 修改会员
export function updateUser(data) {
  return request({
    url: '/customer/v1/customer?google_code=' + data.google_code,
    method: 'put',
    data: data
  })
}

// 修改会员量化
export function updateUserAppQuantificationId(data) {
  return request({
    url: '/customer/v1/customer/quantification?google_code=' + data.google_code,
    method: 'put',
    data: data
  })
}

// 会员密码重置
export function resetUserPwd(id, password, google_code) {
  const data = {
    id,
    password
  }
  return request({
    url: '/uc/v1/reset_pwd/customer?google_code=' + google_code,
    method: 'post',
    data: data
  })
}

// 会员交易密码重置
export function resetTradePwd(id, password, google_code) {
  const data = {
    id,
    password
  }
  return request({
    url: '/uc/v1/reset_pwd/customer_trade?google_code=' + google_code,
    method: 'post',
    data: data
  })
}
